# -*- coding: UTF-8 -*-

numbers = [5, 7, 1, 3, 0, 2, 6, 9, 4, 8]
length = len(numbers)

for i in range(1, length):
    # 标识
    j = i
    tmp = numbers[i]
    insertIndex = i
    while j > 0:
        # 满足条件移动当前数据。不满足退出
        if tmp < numbers[j - 1]:
            numbers[j] = numbers[j - 1]
            insertIndex = j-1
        else:
            break
        j -= 1
    numbers[insertIndex] = tmp


print(numbers)